package com.bwie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.pojo.TbGroup;
import com.bwie.service.TbGroupService;
import com.bwie.mapper.TbGroupMapper;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 牛y
* @description 针对表【tb_group】的数据库操作Service实现
* @createDate 2025-07-26 11:37:16
*/
@Service
public class TbGroupServiceImpl extends ServiceImpl<TbGroupMapper, TbGroup>
    implements TbGroupService{

    @Autowired
    TbGroupMapper tbGroupMapper;

    @Override
    public R getGroupList(PageInfoVo pageInfoVo) {
        Page<TbGroup> tbGroupPage = new Page<>(pageInfoVo.getPageNum(), pageInfoVo.getPageSize());
        QueryWrapper<TbGroup> wrapper = new QueryWrapper<>();
        if(pageInfoVo.getStatusId()!=null){
            wrapper.lambda().eq(TbGroup::getGroupStatus,pageInfoVo.getStatusId());
        }
        wrapper.lambda().orderByDesc(TbGroup::getGroudId);
        Page<TbGroup> selectPage = tbGroupMapper.selectPage(tbGroupPage, wrapper);
        return R.OK(selectPage);
    }
}




